<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/4/28
 * Time: 下午5:01
 */

namespace App\Busi\Modules\Resource;


use App\Busi\Modules\BaseBusi;
use App\Models\News;

class HotNewsListBusi extends BaseBusi
{
    public function handle()
    {
        $where = [
            ["flag", "=", 1]
        ];
        $fields = ["id", "title"];
        $data = News::where($where)->select($fields)->get();
        $hot_list = [];
        foreach ($data as $item) {
            $list = [];
            $tags = $item->tags;
            if ($tags->isEmpty()) continue;

            $list['id'] = $item["id"];
            $list['title'] = $item["title"];

            array_push($hot_list, $list);
        }
        return $hot_list;
    }
}
